package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.cms.service.ModulesShopsService;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ModulesShopsVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/modules/shops")
public class ModulesShopsController extends BaseController {

	@Autowired
	ModulesShopsService modulesShopsService;
	
	@ApiOperation(value="获取该模块店铺列表")
	@RequestMapping(method=RequestMethod.GET)
	public Map<String,Object> findAll(DataTablesParamVO dtp,ModulesShopsVO msv){
		AssertUtil.notBlank(msv.getModulesId(), "modulesId is required");
		return modulesShopsService.findAll(dtp,msv);
	}
	
	@ApiOperation(value="增加模块店铺")
	@RequestMapping(method=RequestMethod.POST)
	public ResultVO addModulesShop(ModulesShopsVO msv){
		AssertUtil.notBlank(msv.getModulesId(), "modulesId is required");
		return modulesShopsService.addModulesShop(msv);
	}
	
	@ApiOperation(value="删除模块店铺")
	@RequestMapping(method=RequestMethod.DELETE)
	public ResultVO delModulesShop(ModulesShopsVO msv){
		AssertUtil.notBlank(msv.getModulesId(), "modulesId is required");
		return modulesShopsService.delModulesShop(msv);
	}
}
